<h1><?php echo $page->getTitle()?></h1>

<?php echo $page->getRaw('body')?>

<?php if($page->getSlug()=='contact_us'):?>
<div id="map" style="width:500px;height:350px"></div>
<script type="text/javascript" src="http://www.google.com/jsapi?key=<?php echo sfConfig::get('app_google_map_api_key')?>"></script>
<script type="text/javascript">
  function getMarker(point, info) {
    var marker = new GMarker(point);

    GEvent.addListener(marker, 'click', function() {
      marker.openInfoWindowHtml("<h3><?php echo sfConfig::get('app_company_name')?></h3> <?php echo str_replace(',', '<br />',sfConfig::get('app_address'))?>");
    });

    return marker;
  }
  google.load("maps", "2.x");

  // Call this function when the page has been loaded
  function initialize() {
    var map = new google.maps.Map2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new google.maps.LatLng(<?php echo sfConfig::get('app_geoposition_latitude')?>, <?php echo sfConfig::get('app_geoposition_longitude')?>), 13);

    geocoder = new GClientGeocoder();
    var address = '<?php echo sfConfig::get('app_address')?>'
    if (geocoder) {
      geocoder.getLatLng(
      address,
      function(point) {
        if (!point) {
          alert(address + " not found, sorry.");
        } else {
          map.setCenter(point, 15);
          var marker = getMarker(point);
          map.addOverlay(marker);
        }
      }
    );
    }
  }
  google.setOnLoadCallback(initialize);
</script>
<?php
  include_partial('contactusform', array('form' => $form));
endif;
?>